package com.lean.android.channel.vasdolly

import android.content.Context
import com.lean.android.ad.core.config.ChannelInfoProvider
import com.lean.android.ad.utils.DeviceHelper
import com.tencent.vasdolly.helper.ChannelReaderUtil

class VasdollyChannelProvider(private val context: Context) : ChannelInfoProvider {

    companion object {
        private const val ChannelOppo = "001"
        private const val ChannelVivo = "002"
        private const val ChannelXiaomi = "003"
        private const val ChannelHuawei = "004"
        private const val ChannelDefault = "000"
    }

    override fun getChannel(): String {
        val channel = ChannelReaderUtil.getChannel(context)
        return if (channel.isNullOrBlank()) ChannelOppo else channel
    }

    override fun getRealChannel(): String {
        return when {
            DeviceHelper.isMIUI() -> ChannelXiaomi
            DeviceHelper.isOppo() -> ChannelOppo
            DeviceHelper.isVivo() -> ChannelVivo
            DeviceHelper.isHuawei() -> ChannelHuawei
            else -> getChannel()
        }
    }
}